package com.dingcan;

import com.dingcan.biao1.NewsDaoImp1;

import java.util.Scanner;

public class Text1{
    public void ordering() throws Exception {
        //super.MenusInfo();
        Scanner scan = new Scanner(System.in);
        System.out.println("********我要订餐*********");
        NewsDaoImp1 newsDaoImp1 = new NewsDaoImp1();
        newsDaoImp1.getNewsByTitle();
        System.out.println("请输入订餐人姓名:");
        String name = scan.next();
        System.out.println("请选择您要点的菜品编号:");
        int num1 = scan.nextInt();
        System.out.println("请选择您需要的份数:");
        int num2 = scan.nextInt();
        System.out.println("请输入送餐时间(送餐时间为10点到20点间整点送餐):");
        String time = scan.next();
        System.out.println("请输入送餐地址:");
        String add = scan.next();
        System.out.println("订餐成功!");
        System.out.println("您订的是:" + num1 + "号菜品" + num2 + "份");
        System.out.println("送餐时间:" + time + "点");
        int answer;
        do {
            System.out.println("输入0返回:");
            answer=scan.nextInt();

        }while(answer!=0);
        com.dingcan.biao3.NewsDaoImp1 newsDaoImp2 = new com.dingcan.biao3.NewsDaoImp1();
        newsDaoImp2.addNews(name,num1,time,add,"35元","已预定");
    }
    public int lookOrder() throws Exception {
        Scanner scan =new Scanner(System.in);
        System.out.println("********查看餐袋*********");
       com.dingcan.biao3.NewsDaoImp1 newsDaoImp3 = new com.dingcan.biao3.NewsDaoImp1();
        newsDaoImp3.getNewsByTitle();
        int answer =1;
        do {
            System.out.println("输入0返回:");
            answer=scan.nextInt();
            if(answer !=0) {
                throw new Exception("你输入的不是0，出现异常");
            }
        }while(answer!=0);
        return 0;
    }
    public int getOrder() throws Exception {
        Scanner scan =new Scanner(System.in);
        System.out.println("********签收订单*********");
        int answer =-1;
        System.out.println("请选择要签收的订单序号:");
        com.dingcan.biao3.NewsDaoImp1 newsDaoImp3 = new com.dingcan.biao3.NewsDaoImp1();
        newsDaoImp3.getNewsByTitle();
        int num1= scan.nextInt();
        com.dingcan.biao3.NewsDaoImp1 newsDaoImp1 = new com.dingcan.biao3.NewsDaoImp1();
        newsDaoImp1.updateNews(num1,"已完成");
        do {
            System.out.println("输入0返回:");
            answer=scan.nextInt();
            if(answer !=0) {
                throw new Exception("你输入的不是0，出现异常");
            }
        }while(answer!=0);
        return 0;
    }
    public int delOrder() throws Exception {


        Scanner scan =new Scanner(System.in);
        System.out.println("********删除订单*********");
        int answer =-1;

        System.out.println("请选择要删除的订单序号:");
        com.dingcan.biao3.NewsDaoImp1 newsDaoImp3 = new com.dingcan.biao3.NewsDaoImp1();
        newsDaoImp3.getNewsByTitle();
        int num2= scan.nextInt();
        com.dingcan.biao3.NewsDaoImp1 newsDaoImp1 = new com.dingcan.biao3.NewsDaoImp1();
        newsDaoImp1.deleteNews(num2);
        do {
            System.out.println("输入0返回:");
            answer=scan.nextInt();
            if(answer !=0) {
                throw new Exception("你输入的不是0，出现异常");
            }
        }while(answer!=0);
        return 0;
    }
    public int likes() throws Exception {

        Scanner scan =new Scanner(System.in);
        System.out.println("********我要点赞*********");
        System.out.println("请选择您要点赞的菜品序号:");
        com.dingcan.biao2.NewsDaoImp1 newsDaoImp1 = new com.dingcan.biao2.NewsDaoImp1();
        System.out.println("序号" +"\t" + "菜单名" + "\t"+"\t"+"点赞数");
        newsDaoImp1.getNewsByTitle();
        int num3 =scan.nextInt();
        com.dingcan.biao2.NewsDaoImp1 newsDaoImp3 = new com.dingcan.biao2.NewsDaoImp1();

        newsDaoImp3.updateNews(num3);
        int answer ;
        do {
            System.out.println("输入0返回:");
            answer=scan.nextInt();
            if(answer !=0) {
                throw new Exception("你输入的不是0，出现异常");
            }
        }while(answer!=0);
        return 0;
    }

}

